﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="entity_reward_select.aspx.cs" Inherits="Customer_Profile.eCard.Reward.entity_reward_select" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register Src="~/mainTop.ascx" TagName="mainTop" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Customer List</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" />
    <meta content="C#" name="CODE_LANGUAGE" />
    <meta content="JavaScript" name="vs_defaultClientScript" />
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/css/style.css" type="text/css" rel="stylesheet" />
    <script language="javascript" type="text/javascript" src="/js/common.js"></script>
    <script language="javascript" type="text/javascript" src="/js/CalPopUp.js"></script>
    <script language="javascript" type="text/javascript">
     function grid_SelectionChanged(s, e) {
         s.GetSelectedFieldValues("deal_no;reward_amount;amount_spread", GetSelectedFieldValuesCallback);
        }
        function GetSelectedFieldValuesCallback(values) {
            var extent_dealno = "";
            var reward_amount = 0;

            try {
                for (var i = 0; i < values.length; i++) {
                    var valueTemp = new Array();
                    valueTemp = values[i].toString().split(",");                    
                    extent_dealno += valueTemp[0] + ",";
                    reward_amount = Number(reward_amount) + Number(valueTemp[1]) + Number(valueTemp[2])
                }
            } finally {
            }
            //alert(reward_amount);
            var hiddealno = document.getElementById("hidDealno");
            hiddealno.value = extent_dealno;
            var reward_amount_txt = document.getElementById("txtSumAmount");
            reward_amount_txt.value = formatFloat(reward_amount, 2);
        }

        function extent_redirect() {
            var hiddealno = document.getElementById("hidDealno");
            var strdealno = hiddealno.value;
            if (strdealno == '') {
                alert("请至少选择一条数据进行申请");
                return false;
            }
            var RewardBankAccount=  document.getElementById("txtRewardBankAccount").value;
            if (RewardBankAccount == '') {
                alert("奖励账户不能为空！");
                return false;
            }

            var SumAmount = document.getElementById("txtSumAmount").value;
            if (SumAmount == '') {
                alert("奖励金额不能为空！");
                return false;
            }

            var AccountName = document.getElementById("txtAccountname").value;
            if (AccountName == '') {
                alert("账号名称不能为空！");
                return false;
            }

            return confirm("你确认提交销售奖励到总部吗?");
        }

      
        function checkForm() {
            var start_date = document.getElementById("txtcreatedatebegin").value;
            var end_date = document.getElementById("txtcreatedateend").value;

            if (trim(start_date) != '' && trim(end_date) != '') {
                if (!strDateTime(start_date)) {
                    alert('起始日期格式不准确');
                    return false;
                }
                if (!strDateTime(end_date)) {
                    alert('结束日期格式不准确');
                    return false;
                }
            }
            return true;
        }

    </script>
    <style type="text/css">
        .style1
        {
            width: 95px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">    
    <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
        <tr>
            <td width="1" background="/images/dot_vline.gif">
                <img height="1" src="/images/spacer.gif" width="1"></td>
            <td valign="top" width="15">
                <img height="1" src="/images/spacer.gif" width="15"></td>
            <td valign="top">
                <table cellspacing="0" cellpadding="0" width="100%" border="0">
                    <tr>
                        <td style="height: 23px">
                            <uc1:mainTop ID="MainTop1" runat="server" />
                            <span class="navi-blu"><span class="navi-blk">首页 &gt; 个人旅行卡管理 &gt; 奖励管理</span>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td background="/images/dot_hline.gif">
                            <img height="1" src="/images/spacer.gif" width="1"></td>
                    </tr>
                </table>
                <table style="position: relative; top: 6px" cellspacing="0" cellpadding="0" width="100%"
                    border="0">
                    <tr>
                        <td>
                            <img height="6" src="/images/corner_lft1.gif" width="6"></td>
                        <td>
                            <div align="right">
                                <img height="6" src="/images/corner_rgt1.gif" width="6"></div>
                        </td>
                    </tr>
                </table>
                <table cellspacing="1" cellpadding="4" width="100%" bgcolor="#c8c8c8" border="0">                        
                    <tr bgcolor="#e9e9e9">
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="100">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">地区：</td>
                                    <td>
                                        <asp:DropDownList ID="dropEntity" runat="server" Width="135">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="100">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">是否已奖励：</td>
                                    <td>
                                        <asp:DropDownList ID="dropIfreward" runat="server" Enabled="false">                                            
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td>
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">销售日期：</td>
                                    <td>
                                        From&nbsp;&nbsp;&nbsp;&nbsp;
                                        <asp:TextBox ID="txtcreatedatebegin" runat="server" CssClass="input2" Width="120px"></asp:TextBox>&nbsp;&nbsp;&nbsp;<img
                                            style="cursor: hand" onclick="JavaScript:calPopForCMon(txtcreatedatebegin, 'ss');"
                                            height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                                        &nbsp;&nbsp;&nbsp;&nbsp;To&nbsp;&nbsp;&nbsp;&nbsp;
                                        <asp:TextBox ID="txtcreatedateend" runat="server" CssClass="input2" Width="120px"></asp:TextBox>&nbsp;&nbsp;&nbsp;<img
                                            style="cursor: hand" onclick="JavaScript:calPopForCMon(txtcreatedateend, 'ss');"
                                            height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <div align="center">
                                <asp:Button ID="btnSearch" runat="server" Text="搜索" class="button" onclientclick="return checkForm()" 
                                    onclick="btnSearch_Click" />&nbsp;                                
                            </div>
                        </td>
                    </tr>
                </table>
                <table style="position: relative; top: -6px" cellspacing="0" cellpadding="0" width="100%"
                    border="0">
                    <tr>
                        <td>
                            <img height="6" src="/images/corner_lft2.gif" width="6"></td>
                        <td>
                            <div align="right">
                                <img height="6" src="/images/corner_rgt2.gif" width="6"></div>
                        </td>
                    </tr>
                </table>
                <table bordercolor="#c2d2e2" cellspacing="0" cellpadding="2" width="100%" border="1">
                    <tr>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td bgcolor="#1765a7">
                                        <img height="11" src="/images/pic_results.gif" width="61"></td>
                                </tr>
                            </table>
                            <dx:ASPxGridView ID="gridReward" runat="server" KeyFieldName="deal_no" Width="100%"
                                CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" 
                                CssPostfix="Office2003Blue">
                                <Images SpriteCssFilePath="~/App_Themes/Office2003Blue/{0}/sprite.css">
                                    <LoadingPanelOnStatusBar Url="~/App_Themes/Office2003Blue/GridView/gvLoadingOnStatusBar.gif">
                                    </LoadingPanelOnStatusBar>
                                    <LoadingPanel Url="~/App_Themes/Office2003Blue/GridView/Loading.gif">
                                    </LoadingPanel>
                                </Images>
                                <ImagesFilterControl>
                                    <LoadingPanel Url="~/App_Themes/Office2003Blue/Editors/Loading.gif">
                                    </LoadingPanel>
                                </ImagesFilterControl>
                                <Styles CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" 
                                    CssPostfix="Office2003Blue">
                                    <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                    </Header>
                                    <LoadingPanel ImageSpacing="10px">
                                    </LoadingPanel>
                                </Styles>
                                <StylesEditors>
                                    <ProgressBar Height="25px">
                                    </ProgressBar>
                                </StylesEditors>
                                <Columns>
                                    <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                                        <HeaderTemplate>
                                             <input type="checkbox" onclick="gridReward.SelectAllRowsOnPage(this.checked);" title="Select/Unselect all rows on the page" />
                                         </HeaderTemplate>
                                         <HeaderStyle HorizontalAlign="Center" />
                                    </dx:GridViewCommandColumn>
                                    <dx:GridViewDataColumn FieldName="deal_no" VisibleIndex="1" Caption="交易号" />                                    
                                    <dx:GridViewDataColumn Caption="卡号" VisibleIndex="2">
                                        <DataItemTemplate>
                                            <a href='/eCard/CardDetail.aspx?cardno=<%#Eval("card_no") %>' target="_blank" ><%#Eval("card_no") %></a>
                                        </DataItemTemplate>
                                    </dx:GridViewDataColumn>
                                    <dx:GridViewDataColumn FieldName="cparty_name" VisibleIndex="3" Caption="客户姓名" />
                                    <dx:GridViewDataColumn FieldName="procduct_name" VisibleIndex="4" Caption="产品名称" />
                                    <dx:GridViewDataColumn FieldName="initial_amount" VisibleIndex="5" Caption="实收金额" />
                                    <dx:GridViewDataColumn FieldName="real_discount" VisibleIndex="6" Caption="销售折扣" />
                                    <dx:GridViewDataColumn FieldName="commission_percent" VisibleIndex="7" Caption="奖励比率" />
                                    <dx:GridViewDataColumn FieldName="reward_amount" VisibleIndex="8" Caption="销售奖励金额" />
                                    <dx:GridViewDataColumn FieldName="should_amount" VisibleIndex="9" Caption="实收金额" />
                                    <dx:GridViewDataColumn FieldName="amount_spread" VisibleIndex="10" Caption="销售差额" />
                                    <dx:GridViewDataColumn FieldName="spread_rewardAmount" VisibleIndex="11" Caption="差额奖励" />
                                    <dx:GridViewDataColumn FieldName="submit_date" VisibleIndex="12" Caption="提交日" />
                                </Columns>
                                <ClientSideEvents SelectionChanged="grid_SelectionChanged" />
                                <Settings ShowFooter="True" />
                                <TotalSummary>
                                     <dx:ASPxSummaryItem FieldName="initial_amount" SummaryType="Sum" DisplayFormat="c"/>
                                     <dx:ASPxSummaryItem FieldName="reward_amount" SummaryType="Sum" DisplayFormat="c"/>
                                     <dx:ASPxSummaryItem FieldName="spread_rewardAmount" SummaryType="Sum" DisplayFormat="c"/>
                                </TotalSummary>
                            </dx:ASPxGridView>
                            <asp:HiddenField ID="hidDealno" runat="server" />
                        </td>
                    </tr>
                </table>
                <table cellspacing="0" cellpadding="0" width="100%" border="0">
                    <tr>
                        <td>
                            <img height="3" src="/images/spacer.gif" width="1"></td>
                    </tr>
                </table>
                <table cellspacing="1" cellpadding="4" width="100%" bgcolor="#c8c8c8" border="0">                        
                    <tr bgcolor="#e9e9e9">
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="100">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">奖励年月：                                        
                                    </td>
                                    <td>
                                        <asp:DropDownList ID="dropYear" runat="server">
                                            <asp:ListItem Text="2013" Value="2013"></asp:ListItem>
                                            <asp:ListItem Text="2014" Value="2014"></asp:ListItem>
                                            <asp:ListItem Text="2015" Value="2015"></asp:ListItem>
                                            <asp:ListItem Text="2016" Value="2016"></asp:ListItem>
                                            <asp:ListItem Text="2017" Value="2017"></asp:ListItem>
                                            <asp:ListItem Text="2018" Value="2018"></asp:ListItem>
                                            <asp:ListItem Text="2019" Value="2018"></asp:ListItem>
                                        </asp:DropDownList>
                                        <asp:DropDownList ID="dropMonth" runat="server">
                                            <asp:ListItem Text="01" Value="01"></asp:ListItem>
                                            <asp:ListItem Text="02" Value="02"></asp:ListItem>
                                            <asp:ListItem Text="03" Value="03"></asp:ListItem>
                                            <asp:ListItem Text="04" Value="04"></asp:ListItem>
                                            <asp:ListItem Text="05" Value="05"></asp:ListItem>
                                            <asp:ListItem Text="06" Value="06"></asp:ListItem>
                                            <asp:ListItem Text="07" Value="07"></asp:ListItem>
                                            <asp:ListItem Text="08" Value="08"></asp:ListItem>
                                            <asp:ListItem Text="09" Value="09"></asp:ListItem>
                                            <asp:ListItem Text="10" Value="10"></asp:ListItem>
                                            <asp:ListItem Text="11" Value="11"></asp:ListItem>
                                            <asp:ListItem Text="12" Value="12"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="100">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">奖励总额：</td>
                                    <td>
                                        <asp:TextBox ID="txtSumAmount" class="input2" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td>
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">安新卡号：<font color="red">*</font>
                                    </td>
                                    <td>
                                       <asp:TextBox ID="txtRewardBankAccount" class="input2" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td>
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">员工号：
                                    </td>
                                    <td>
                                       <asp:TextBox ID="txtStaffno" class="input2" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>     
                        <td>
                           <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td>
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">安新卡姓名：
                                    </td>
                                    <td>
                                       <asp:TextBox ID="txtAccountname" class="input2" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>                  
                    </tr>
                    <tr  bgcolor="#e9e9e9">
                        <td colspan=4>
                             <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td class="style1">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">备注：
                                    </td>
                                    <td>
                                       <asp:TextBox ID="txtRemark" class="input2" runat="server" width="98%" ></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                         <td>
                            <div align="center">                                
                                <asp:Button ID="btnSubmit" runat="server" Text="奖励申请" class="button" OnClientClick="return extent_redirect();"
                                    onclick="btnSubmit_Click" />
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
            <td valign="top" width="10">
                <img height="1" alt="" src="/images/spacer.gif" width="10"></td>
        </tr>
    </table>
    </form>
</body>
<%=strScript %>
</html>